﻿using System;
using Xtensive.Storage;

namespace Sherwood.Content.DO.Model
{
    /// <summary>
    /// Represents an external client that may provide or consume data.
    /// </summary>
    [HierarchyRoot]
    [Serializable]
    [KeyGenerator(KeyGeneratorKind.None)]
    public class Client : Entity, IClient
    {
        public Client(string id, string description) 
            : base(id)
        {
            Description = description;
        }

        /// <inheritdoc/>
        [Field(Length = 32), Key]
        public string Id { get; private set; }

        /// <inheritdoc/>
        [Field(Length = 256)]
        public string Description { get; set; }

        /// <inheritdoc/>
        [Field(Length = 2048)]
        public string PublicKey { get; set; }

        public override string ToString()
        {
            return Id + " (" + Description + ")";
        }
    }
}
